//
//  CustomButton.m
//  HItsBrige
//
//  Created by apple on 2019/3/20.
//  Copyright © 2019年 apple. All rights reserved.
//

#import "CustomButton.h"

@implementation CustomButton

-(instancetype)initWithFrame:(CGRect)frame andImageName:(NSString*)imageName andTitle:(NSString*)title andColor:(UIColor*)color andFont:(CGFloat)font;{
    if (self=[super initWithFrame:frame]) {
        
        [self addPropertyTitle:title andColor:color andFont:font];
        [self setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    }
    return self;
}
-(instancetype)initWithFrame:(CGRect)frame  andTitle:(NSString*)title andColor:(UIColor*)color andFont:(CGFloat)font;
{
    if (self=[super initWithFrame:frame]) {
        [self addPropertyTitle:title andColor:color andFont:font];
    }
    return self;
}

-(void)addPropertyTitle:(NSString*)title andColor:(UIColor*)color andFont:(CGFloat)font{
    
    [self setTitle:title forState:UIControlStateNormal];
    self.titleLabel.font=[UIFont systemFontOfSize:font];
    [self setTitleColor:color forState:UIControlStateNormal];
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
